package com.kaibes.core.base.tag;

public class TagObject {

    private Object obj;
    private TagMethod method;
    
    public TagObject(Object obj) {
        this.obj = obj;
        method = TagMethods.createMethod(obj.getClass());
    }
    
    @SuppressWarnings("unchecked")
    public <T> T doMethod(String tag, Object... args) throws NoSuchMethodException {
        return (T) method.doMethod(obj, tag, args);
    }
    
    @SuppressWarnings("unchecked")
    public <T> T doMethod(int tag, Object... args) throws NoSuchMethodException {
        return (T) method.doMethod(obj, String.valueOf(tag), args);
    }
    
}
